package com.chen106106.sstest.action;

import org.apache.commons.lang3.StringUtils;

import com.opensymphony.xwork2.ActionSupport;

/**
 * 用户登录，用struts2的validation，通过xml的方式配置
 * @author zhenai
 * 2012-7-17 下午3:34:46
 */
public class LoginAction extends ActionSupport{
	
	    private String userName;
	    private String password;

	    public LoginAction() {
	    }
	    
	    
//	    @Override
//	    public void validate() {
//	    	if(StringUtils.isEmpty(userName)){
//	    		addFieldError("userName", "username is requied!");
//	    	}else if(!"hello".equals(userName)){
//	    		addFieldError("userName", "Invalid User");
//	    	}else if(StringUtils.isEmpty(password)){
//	    		addFieldError("password", getText("password.required", "requied password!"));
//	    	}
//	    }
	    public String execute() {
	        return SUCCESS;
	    }

	    public String getUserName() {
	        return userName;
	    }

	    public void setUserName(String userName) {
	        this.userName = userName;
	    }

	    public String getPassword() {
	        return password;
	    }

	    public void setPassword(String password) {
	        this.password = password;
	    }
	}